package Gui;
import javax.swing.*;
import java.awt.*;

public class MyFrame1 extends JFrame{
    JPanel jp1,jp2,jp3;
    JLabel lable1,lable2;
    JButton button1,button2;
    JTextField text;
    JPasswordField password;

    public static void main(String[] args) {
        MyFrame1 myFrame1 = new MyFrame1();
    }

    public MyFrame1(){
        init();
        setTitle("登录界面");
        setBounds(600,600,500,300);
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    //初始化
    void init(){
        setLayout(new GridLayout(3,1));
        jp1 = new JPanel();
        jp2 = new JPanel();
        jp3 = new JPanel();

        lable1 = new JLabel("用户名：");
        lable2 = new JLabel("密码：");

        text = new JTextField(7);
        password = new JPasswordField(7);

        button1 = new JButton("登录");
        button2 = new JButton("取消");

        jp1.add(lable1);
        jp1.add(text);

        jp2.add(lable2);
        jp2.add(password);

        jp3.add(button1);
        jp3.add(button2);

        add(jp1);
        add(jp2);
        add(jp3);


    }
}
